

// source idl: com.erp.company.ao.idl.CompanyAo.java

#ifndef COMPANYAO_STUB_4_WEB_H
#define COMPANYAO_STUB_4_WEB_H

#include <string>
#include <sstream>
#include "app_platform/cmd_obj.h"
#include "app_platform/cgi_stub_cntl.h"
#include "c2cent/base/basestub4web.h"
#include "app_platform/cntl_info.h"
#include "app_platform/intf_serializable.h"
#include "app_platform/intf_service_object.h"
#include <set>	
#include <map>	
#include <vector>	
#include "erp/company/po/companyfilterpo_company.h"	
#include "erp/company/po/companyinfopo_company.h"	
#include "intf_companyao.h"

namespace erp
{
namespace company
{
namespace ao
{
	#define COMPANYAO_STUB4WEB_VERSION "ERP_COMPANY_AO___COMPANYAO__STUB4WEB_VERSION__1.0 2013-10-25 10:15:56"
    const std::string COMPANYAO_STUB4WEB_NOUSE = COMPANYAO_STUB4WEB_VERSION;

	const uint32_t COMPANYAO_ADDANDUPDATECOMPANYINFO_REQ_CMD_ID = 0xc0670001; /// 请求命令号
	const uint32_t COMPANYAO_ADDANDUPDATECOMPANYINFO_RESP_CMD_ID = 0xc0678001; /// 回应命令号
	

	const uint32_t COMPANYAO_DELETECOMPANYINFO_REQ_CMD_ID = 0xc0670002; /// 请求命令号
	const uint32_t COMPANYAO_DELETECOMPANYINFO_RESP_CMD_ID = 0xc0678002; /// 回应命令号
	

	const uint32_t COMPANYAO_GETCOMPANYINFOBYFILTER_REQ_CMD_ID = 0xc0670004; /// 请求命令号
	const uint32_t COMPANYAO_GETCOMPANYINFOBYFILTER_RESP_CMD_ID = 0xc0678004; /// 回应命令号
	

	const uint32_t COMPANYAO_GETCOMPANYINFOBYIDS_REQ_CMD_ID = 0xc0670003; /// 请求命令号
	const uint32_t COMPANYAO_GETCOMPANYINFOBYIDS_RESP_CMD_ID = 0xc0678003; /// 回应命令号
	


	const uint16_t COMPANYAO_MAX_PROTOCAL_VERSION = 2; //>平台支持的最大协议版本号

///////////////////////////// STRUCTS /////////////////////////////////////////////////
	/**
	 *
 	 * 
	 *
	 *
 	 * @date 2013-10-25 10:15:56
 	 * @version 0
	 */	
	struct CAddAndUpdateCompanyInfoReq : public IServiceObject, public ISerializableXML
	{
		std::string machineKey;
		std::string source;
		uint32_t sceneId;
		uint32_t option;
		erp::company::po::CCompanyInfoPo companyInfoPo;
		std::string inReserve;
		std::string errmsg;
		std::string outReserve;
		
	    virtual uint32_t getCmdId() const { return COMPANYAO_ADDANDUPDATECOMPANYINFO_REQ_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
			//检查协议的版本号
		    //if(bs.getVersion() > COMPANYAO_MAX_PROTOCAL_VERSION)
		    //return false;
			bs & machineKey;
			bs & source;
			bs & sceneId;
			bs & option;
			companyInfoPo.Serialize(bs);
			bs & inReserve;
		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-25 10:15:56
 	 * @version 0
	 */	
	struct CAddAndUpdateCompanyInfoResp : public IServiceObject, public ISerializableXML
	{
		uint32_t dwResult;
		std::string errmsg;
		std::string outReserve;
	
	    virtual uint32_t getCmdId() const { return COMPANYAO_ADDANDUPDATECOMPANYINFO_RESP_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
		    bs & dwResult;
			bs & errmsg;
			bs & outReserve;
		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	/**
	 *
 	 * 
	 *
	 *
 	 * @date 2013-10-25 10:15:56
 	 * @version 0
	 */	
	struct CDeleteCompanyInfoReq : public IServiceObject, public ISerializableXML
	{
		std::string machineKey;
		std::string source;
		uint32_t sceneId;
		uint32_t option;
		uint64_t companySysNo;
		std::string inReserve;
		std::string errmsg;
		std::string outReserve;
		
	    virtual uint32_t getCmdId() const { return COMPANYAO_DELETECOMPANYINFO_REQ_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
			//检查协议的版本号
		    //if(bs.getVersion() > COMPANYAO_MAX_PROTOCAL_VERSION)
		    //return false;
			bs & machineKey;
			bs & source;
			bs & sceneId;
			bs & option;
			bs & companySysNo;
			bs & inReserve;
		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-25 10:15:56
 	 * @version 0
	 */	
	struct CDeleteCompanyInfoResp : public IServiceObject, public ISerializableXML
	{
		uint32_t dwResult;
		std::string errmsg;
		std::string outReserve;
	
	    virtual uint32_t getCmdId() const { return COMPANYAO_DELETECOMPANYINFO_RESP_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
		    bs & dwResult;
			bs & errmsg;
			bs & outReserve;
		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	/**
	 *
 	 * 
	 *
	 *
 	 * @date 2013-10-25 10:15:56
 	 * @version 0
	 */	
	struct CGetCompanyInfoByFilterReq : public IServiceObject, public ISerializableXML
	{
		std::string machineKey;
		std::string source;
		uint32_t sceneId;
		uint32_t option;
		erp::company::po::CCompanyFilterPo filter;
		std::string inReserve;
		std::string errmsg;
		uint32_t total;
		std::vector<erp::company::po::CCompanyInfoPo > companyInfoPo;
		std::string outReserve;
		
	    virtual uint32_t getCmdId() const { return COMPANYAO_GETCOMPANYINFOBYFILTER_REQ_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
			//检查协议的版本号
		    //if(bs.getVersion() > COMPANYAO_MAX_PROTOCAL_VERSION)
		    //return false;
			bs & machineKey;
			bs & source;
			bs & sceneId;
			bs & option;
			filter.Serialize(bs);
			bs & inReserve;
		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-25 10:15:56
 	 * @version 0
	 */	
	struct CGetCompanyInfoByFilterResp : public IServiceObject, public ISerializableXML
	{
		uint32_t dwResult;
		std::string errmsg;
		uint32_t total;
		std::vector<erp::company::po::CCompanyInfoPo > companyInfoPo;
		std::string outReserve;
	
	    virtual uint32_t getCmdId() const { return COMPANYAO_GETCOMPANYINFOBYFILTER_RESP_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
		    bs & dwResult;
			bs & errmsg;
			bs & total;
			bs & companyInfoPo;
			bs & outReserve;
		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	/**
	 *
 	 * 
	 *
	 *
 	 * @date 2013-10-25 10:15:56
 	 * @version 0
	 */	
	struct CGetCompanyInfoByIdsReq : public IServiceObject, public ISerializableXML
	{
		std::string machineKey;
		std::string source;
		uint32_t sceneId;
		uint32_t option;
		std::set<uint64_t > companySysNo;
		std::string inReserve;
		std::string errmsg;
		std::map<uint64_t,uint32_t > errorCode;
		std::map<uint64_t,std::string > errorMsg;
		std::map<uint64_t,erp::company::po::CCompanyInfoPo > companyInfoPo;
		std::string outReserve;
		
	    virtual uint32_t getCmdId() const { return COMPANYAO_GETCOMPANYINFOBYIDS_REQ_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
			//检查协议的版本号
		    //if(bs.getVersion() > COMPANYAO_MAX_PROTOCAL_VERSION)
		    //return false;
			bs & machineKey;
			bs & source;
			bs & sceneId;
			bs & option;
			bs & companySysNo;
			bs & inReserve;
		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-25 10:15:56
 	 * @version 0
	 */	
	struct CGetCompanyInfoByIdsResp : public IServiceObject, public ISerializableXML
	{
		uint32_t dwResult;
		std::string errmsg;
		std::map<uint64_t,uint32_t > errorCode;
		std::map<uint64_t,std::string > errorMsg;
		std::map<uint64_t,erp::company::po::CCompanyInfoPo > companyInfoPo;
		std::string outReserve;
	
	    virtual uint32_t getCmdId() const { return COMPANYAO_GETCOMPANYINFOBYIDS_RESP_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
		    bs & dwResult;
			bs & errmsg;
			bs & errorCode;
			bs & errorMsg;
			bs & companyInfoPo;
			bs & outReserve;
		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	class CCompanyAoStub4Web : public c2cent::CBaseStub4Web, public ICompanyAo	{
		public:
			uint32_t AddAndUpdateCompanyInfo(
				const CCntlInfo& rCntlInfo,

				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::company::po::CCompanyInfoPo& companyInfoPo,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve
			);
			uint32_t DeleteCompanyInfo(
				const CCntlInfo& rCntlInfo,

				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				uint64_t companySysNo,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve
			);
			uint32_t GetCompanyInfoByFilter(
				const CCntlInfo& rCntlInfo,

				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::company::po::CCompanyFilterPo& filter,
				const std::string& inReserve,
				std::string& errmsg,
				uint32_t& total,
				std::vector<erp::company::po::CCompanyInfoPo >& companyInfoPo,
				std::string& outReserve
			);
			uint32_t GetCompanyInfoByIds(
				const CCntlInfo& rCntlInfo,

				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const std::set<uint64_t >& companySysNo,
				const std::string& inReserve,
				std::string& errmsg,
				std::map<uint64_t,uint32_t >& errorCode,
				std::map<uint64_t,std::string >& errorMsg,
				std::map<uint64_t,erp::company::po::CCompanyInfoPo >& companyInfoPo,
				std::string& outReserve
			);
	};
	
	/**
	 *
 	 * 添加/修改用户企业信息；传入用户企业SysNo不为0时则进行修改，反之则进行添加；
	 *
		 *@param String machineKey: 机器码，必填  				
		 *@param String source: 调用来源，必填  				
		 *@param uint32_t sceneId: 场景ID，必填  				
		 *@param uint32_t option: 功能选项，扩展选填  				
		 *@param CompanyInfoPo companyInfoPo: 用户企业PO，必填  				
		 *@param String inReserve: 请求保留字  				
		 *@param String errmsg: 错误信息  		
		 *@param String outReserve: 返回保留字   		
     *
     *@return uint32_t : 0(成功) 其它失败
	 */	
	inline uint32_t CCompanyAoStub4Web::AddAndUpdateCompanyInfo(
				const CCntlInfo& rCntlInfo,

				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::company::po::CCompanyInfoPo& companyInfoPo,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve
	)
	{
		 CAddAndUpdateCompanyInfoReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.companyInfoPo = companyInfoPo;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.outReserve = outReserve;
		 
		// CCGI_STUB_CNTL->setRouteKey(uint32_t routeKey); 没有设置routeKey  
		
	    CCGI_STUB_CNTL->setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			CCGI_STUB_CNTL->setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
		if((iRetCode = CCGI_STUB_CNTL->putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed: ";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(COMPANYAO_ADDANDUPDATECOMPANYINFO_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << COMPANYAO_ADDANDUPDATECOMPANYINFO_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CAddAndUpdateCompanyInfoResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
		    
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
		    
		return oResp.dwResult;
	}
	/**
	 *
 	 * 删除用户企业（逻辑）
	 *
		 *@param String machineKey: 机器码，必填  				
		 *@param String source: 调用来源，必填  				
		 *@param uint32_t sceneId: 场景ID，必填  				
		 *@param uint32_t option: 功能选项，扩展选填  				
		 *@param uint64_t companySysNo: 需删除用户企业的SysNo，必填  				
		 *@param String inReserve: 请求保留字  				
		 *@param String errmsg: 错误信息  		
		 *@param String outReserve: 返回保留字   		
     *
     *@return uint32_t : 0(成功) 其它失败
	 */	
	inline uint32_t CCompanyAoStub4Web::DeleteCompanyInfo(
				const CCntlInfo& rCntlInfo,

				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				uint64_t companySysNo,
				const std::string& inReserve,
				std::string& errmsg,
				std::string& outReserve
	)
	{
		 CDeleteCompanyInfoReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.companySysNo = companySysNo;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.outReserve = outReserve;
		 
		// CCGI_STUB_CNTL->setRouteKey(uint32_t routeKey); 没有设置routeKey  
		
	    CCGI_STUB_CNTL->setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			CCGI_STUB_CNTL->setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
		if((iRetCode = CCGI_STUB_CNTL->putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed: ";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(COMPANYAO_DELETECOMPANYINFO_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << COMPANYAO_DELETECOMPANYINFO_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CDeleteCompanyInfoResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
		    
			errmsg  = oResp.errmsg;
			outReserve  = oResp.outReserve;
		    
		return oResp.dwResult;
	}
	/**
	 *
 	 * 根据过滤条件查询用户企业列表信息
	 *
		 *@param String machineKey: 机器码，必填  				
		 *@param String source: 调用来源，必填  				
		 *@param uint32_t sceneId: 场景ID，必填  				
		 *@param uint32_t option: 功能选项，扩展选填  				
		 *@param CompanyFilterPo filter: 过滤器，必填  				
		 *@param String inReserve: 请求保留字  				
		 *@param String errmsg: 错误信息  		
		 *@param uint32_t total: 用户企业总数 		
		 *@param Vector companyInfoPo: 用户企业列表信息 		
		 *@param String outReserve: 返回保留字   		
     *
     *@return uint32_t : 0(成功) 其它失败
	 */	
	inline uint32_t CCompanyAoStub4Web::GetCompanyInfoByFilter(
				const CCntlInfo& rCntlInfo,

				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const erp::company::po::CCompanyFilterPo& filter,
				const std::string& inReserve,
				std::string& errmsg,
				uint32_t& total,
				std::vector<erp::company::po::CCompanyInfoPo >& companyInfoPo,
				std::string& outReserve
	)
	{
		 CGetCompanyInfoByFilterReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.filter = filter;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.total = total;
			oReq.companyInfoPo = companyInfoPo;
			oReq.outReserve = outReserve;
		 
		// CCGI_STUB_CNTL->setRouteKey(uint32_t routeKey); 没有设置routeKey  
		
	    CCGI_STUB_CNTL->setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			CCGI_STUB_CNTL->setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
		if((iRetCode = CCGI_STUB_CNTL->putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed: ";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(COMPANYAO_GETCOMPANYINFOBYFILTER_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << COMPANYAO_GETCOMPANYINFOBYFILTER_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CGetCompanyInfoByFilterResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
		    
			errmsg  = oResp.errmsg;
			total  = oResp.total;
			companyInfoPo  = oResp.companyInfoPo;
			outReserve  = oResp.outReserve;
		    
		return oResp.dwResult;
	}
	/**
	 *
 	 * 根据用户企业ID批量获取用户企业信息
	 *
		 *@param String machineKey: 机器码，必填  				
		 *@param String source: 调用来源，必填  				
		 *@param uint32_t sceneId: 场景ID，必填  				
		 *@param uint32_t option: 功能选项，扩展选填  				
		 *@param Set companySysNo: 需获取的用户企业SysNo，必填  				
		 *@param String inReserve: 请求保留字  				
		 *@param String errmsg: 错误信息  		
		 *@param Map errorCode: 获取失败的错误码 		
		 *@param Map errorMsg: 获取失败的错误信息 		
		 *@param Map companyInfoPo: 获取成功的用户企业信息 		
		 *@param String outReserve: 返回保留字   		
     *
     *@return uint32_t : 0(成功) 其它失败
	 */	
	inline uint32_t CCompanyAoStub4Web::GetCompanyInfoByIds(
				const CCntlInfo& rCntlInfo,

				const std::string& machineKey,
				const std::string& source,
				uint32_t sceneId,
				uint32_t option,
				const std::set<uint64_t >& companySysNo,
				const std::string& inReserve,
				std::string& errmsg,
				std::map<uint64_t,uint32_t >& errorCode,
				std::map<uint64_t,std::string >& errorMsg,
				std::map<uint64_t,erp::company::po::CCompanyInfoPo >& companyInfoPo,
				std::string& outReserve
	)
	{
		 CGetCompanyInfoByIdsReq oReq;
			oReq.machineKey = machineKey;
			oReq.source = source;
			oReq.sceneId = sceneId;
			oReq.option = option;
			oReq.companySysNo = companySysNo;
			oReq.inReserve = inReserve;
			oReq.errmsg = errmsg;
			oReq.errorCode = errorCode;
			oReq.errorMsg = errorMsg;
			oReq.companyInfoPo = companyInfoPo;
			oReq.outReserve = outReserve;
		 
		// CCGI_STUB_CNTL->setRouteKey(uint32_t routeKey); 没有设置routeKey  
		
	    CCGI_STUB_CNTL->setPassport(
	        rCntlInfo.getOperatorUin(), 
	        rCntlInfo.getOperatorKey().c_str(),
	        rCntlInfo.getOperatorClientIP());
	
		if(const_cast<CCntlInfo&>(rCntlInfo).isRouteKeySet())	
			CCGI_STUB_CNTL->setUin(const_cast<CCntlInfo&>(rCntlInfo).getRouteKey());	
	    
	    int iRetCode = 0;
		m_sErrMsg.clear();
		if((iRetCode = CCGI_STUB_CNTL->putSvcObj(&oReq, 0)) != 0)
	    {
			m_sErrMsg = "DoRequest failed: ";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
	        return iRetCode;
	    }
	    
	    // Send & Recv
		if((iRetCode = SendRecv()) != 0)
		{
			if(99 == iRetCode) // UDP & Need No Response
				return 0;
	
			std::stringstream oss;
			oss << m_lTimeout;
	        m_sErrMsg = "Send & Recv Timeout(";
			m_sErrMsg += oss.str();
			m_sErrMsg += "s) ";
			m_sErrMsg += CCGI_STUB_CNTL->GetLastErrMsg();
			return iRetCode;
	    }
	    
		if(!m_poCmd->isValid(COMPANYAO_GETCOMPANYINFOBYIDS_RESP_CMD_ID))
	    {
	        std::stringstream oss;
            oss << "Cmd not match: "
                << "Expected cmd=" << std::hex << COMPANYAO_GETCOMPANYINFOBYIDS_RESP_CMD_ID << std::dec << " != "
                << "actualed cmd=" << std::hex << m_poCmd->getCmdId() << std::dec;
            m_sErrMsg = oss.str();
        
	        return 0xEE0024;
	    }
	    
	    char* pBuf = NULL; uint32_t nLen = 0;
	    m_poCmd->getBuffer(pBuf, nLen);
	    CByteStreamNetwork bs(pBuf, nLen);
	    bs.isStoring(false);
	    
	    CGetCompanyInfoByIdsResp oResp;
	    if(!oResp.Serialize(bs))
	    {
	        m_sErrMsg = "Resp.Serialize(bs) failed";
	        return 0xEE0028;
	    }
		    
			errmsg  = oResp.errmsg;
			errorCode  = oResp.errorCode;
			errorMsg  = oResp.errorMsg;
			companyInfoPo  = oResp.companyInfoPo;
			outReserve  = oResp.outReserve;
		    
		return oResp.dwResult;
	}
		
}
}
}

#endif /* COMPANYAO_STUB_4_WEB_H */
